package com.test.schoolhelper.ui.fragment;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.test.schoolhelper.R;
import com.test.schoolhelper.base.BaseFragment;
import com.test.schoolhelper.databinding.FragmentToolsBinding;
import com.test.schoolhelper.ui.activity.AddAlarmActivity;
import com.test.schoolhelper.ui.activity.AddScheduleActivity;
import com.test.schoolhelper.ui.activity.CalculatorActivity;
import com.test.schoolhelper.ui.activity.MusicActivity;
import com.test.schoolhelper.ui.activity.UserActivity;

// TODO: 2024/5/29 工具
public class ToolsFragment  extends BaseFragment<FragmentToolsBinding> implements View.OnClickListener {


    @Override
    protected void initClick() {
        super.initClick();
        getBinding().rlCalculator.setOnClickListener(this);
        getBinding().rlMusic.setOnClickListener(this);
        getBinding().rlSchedule.setOnClickListener(this);
        getBinding().rlPhone.setOnClickListener(this);
        getBinding().rlAlarm.setOnClickListener(this);
    }

    @Override
    protected int initLayout() {
        return R.layout.fragment_tools;
    }

    @Override
    protected FragmentToolsBinding onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) {
        return FragmentToolsBinding.inflate(inflater);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.rl_calculator:
                startActivity(new Intent(getActivity(), CalculatorActivity.class));
                break;
            case R.id.rl_phone:
                startActivity(new Intent(getActivity(), UserActivity.class));
                break;
            case R.id.rl_music:
                startActivity(new Intent(getActivity(), MusicActivity.class));
                break;
            case R.id.rl_schedule:
                startActivity(new Intent(getActivity(), AddScheduleActivity.class));
                break;
            case R.id.rl_alarm:
                startActivity(new Intent(getActivity(), AddAlarmActivity.class));
                break;
        }
    }
}
